<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="div1">

    </div>
    <script type="text/javascript">
        window.onload = function () {
            var div1 = document.getElementById("div1");

            //读取标签包裹内容
            var text = div1.innerHTML;
            alert(text);

            //写入
            div1.innerHTML="<a href='https://www.baidu.com'>百度</a>"
        }
    </script>
</body>
</html>